home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / WASTE 1.3a1.sit / WASTE 1.3a1 Distribution / WASTE Pascal Interfaces / WASTE.p < prev    next >
Encoding:
Text File  |  1996-08-23  |  27.9 KB  |  936 lines  |  [TEXT/CWIE]

  1. UNIT WASTE;
  2.  
  3. { Pascal interface to the WASTE text engine }
  4.  
  5. { version 1.3a1 (August 1996) }
  6.  
  7. { Copyright ゥ 1993-1996 Marco Piovanelli }
  8. { All Rights Reserved }
  9.  
  10. INTERFACE
  11.     USES
  12.         ConditionalMacros,
  13.         Types,
  14.         MixedMode,
  15.         QuickdrawText,
  16.         Quickdraw,
  17.         Script,
  18.         TextUtils,
  19.         TextEdit,
  20.         Drag,
  21.         LongCoords;
  22.  
  23. {$PUSH}
  24. {$ALIGN MAC68K}
  25. {$LibExport+}
  26.  
  27.     CONST
  28.  
  29. { result codes }
  30.  
  31.         weCantUndoErr = -10015;                    { undo buffer is clear (= errAECantUndo) }
  32.         weEmptySelectionErr = -10013;            { empty selection range (= errAENoUserSelection) }
  33.         weNotHandledErr = -1708;                { please use default behavior (= errAEEventNotHandled) }
  34.         weUnknownObjectTypeErr = -9478;            { specified object type is not registered }
  35.         weObjectNotFoundErr = -9477;            { no object found at specified offset }
  36.         weReadOnlyErr = -9476;                    { cannot modify instance }
  37.         weUndefinedSelectorErr = -50;            { unknown selector (= paramErr) }
  38.  
  39. { alignment styles }
  40.  
  41.         weFlushLeft = -2;                    { flush left }
  42.         weFlushRight = -1;                    { flush right }
  43.         weFlushDefault = 0;                    { flush according to system direction }
  44.         weCenter = 1;                        { centered }
  45.         weJustify = 2;                        { fully justified }
  46.  
  47. { primary line direction }
  48.  
  49.         weDirDefault = 1;                    { according to system direction }
  50.         weDirRightToLeft = -1;                { force right-to-left }
  51.         weDirLeftToRight = 0;                { force left-to-right }
  52.  
  53. { values for the mode parameter in WESetStyle and WEContinuousStyle }
  54.  
  55.         weDoFont                     = $0001;    { set font family number }
  56.         weDoFace                     = $0002;    { set Quickdraw styles }
  57.         weDoSize                     = $0004;    { set type size }
  58.         weDoColor                     = $0008;    { set color }
  59.         weDoAll                     = weDoFont + weDoFace + weDoSize + weDoColor;
  60.         weDoAddSize                 = $0010;    { adjust type size }
  61.         weDoToggleFace                 = $0020;    { turn a style off if it's continuous over the selection }
  62.         weDoReplaceFace             = $0040;    { replace existing styles outright }
  63.         weDoPreserveScript            = $0080;    { don't change scripts when applying a font change }
  64.         weDoExtractSubscript         = $0100;    { extract subscripts when applying a font change }
  65.         weDoFaceMask                 = $0200;    { set Quickdraw styles using mask field }
  66.  
  67. { values for the edge parameter in WEGetOffset etc. }
  68.  
  69.         kLeadingEdge = -1;            { point is on the leading edge of a glyph }
  70.         kTrailingEdge = 0;            { point is on the trailing edge of a glyph }
  71.         kObjectEdge = 2;            { point is in the middle of an embedded object }
  72.  
  73. { values for WEFeatureFlag feature parameter }
  74.  
  75.         weFAutoScroll                 = 0;            { automatically scroll the selection range into view }
  76.         weFOutlineHilite             = 2;            { frame selection when deactivated }
  77.         weFReadOnly                 = 5;            { disallow modifications }
  78.         weFUndo                     = 6;            { support WEUndo }
  79.         weFIntCutAndPaste             = 7;            { use intelligent cut-and-paste rules }
  80.         weFDragAndDrop                 = 8;            { support drag-and-drop text editing }
  81.         weFInhibitRecal             = 9;            { don't recalculate line starts and don't redraw text }
  82.         weFUseTempMem                 = 10;            { use temporary memory for main data structures }
  83.         weFDrawOffscreen             = 11;            { draw text offscreen for smoother visual results }
  84.         weFInhibitRedraw             = 12;            { don't redraw text }
  85.         weFMonoStyled                = 13;            { disallow style changes }
  86.         weFInhibitColor             = 31;            { draw in black & white only }
  87.  
  88. { values for WENew flags parameter }
  89.  
  90.         weDoAutoScroll                 = $00000001;
  91.         weDoOutlineHilite             = $00000004;
  92.         weDoReadOnly                 = $00000020;
  93.         weDoUndo                     = $00000040;
  94.         weDoIntCutAndPaste             = $00000080;
  95.         weDoDragAndDrop             = $00000100;
  96.         weDoInhibitRecal             = $00000200;
  97.         weDoUseTempMem                 = $00000400;
  98.         weDoDrawOffscreen             = $00000800;
  99.         weDoInhibitRedraw            = $00001000;
  100.         weDoMonoStyled                = $00002000;
  101.         weDoInhibitColor            = $80000000;
  102.  
  103. { values for WEFeatureFlag action parameter }
  104.  
  105.         weBitToggle = -2;        { toggles the specified feature }
  106.         weBitTest = -1;            { returns the current setting of the specified feature }
  107.         weBitClear = 0;            { disables the specified feature }
  108.         weBitSet = 1;            { enables the specified feature }
  109.  
  110. { values for WEGetInfo and WESetInfo selector parameter }
  111.  
  112.         weCharByteHook             = 'cbyt';    { CharByte hook }
  113.         weCharToPixelHook         = 'c2p ';    { CharToPixel hook }
  114.         weCharTypeHook             = 'ctyp';    { CharType hook }
  115.         weClickLoop             = 'clik';    { click loop callback }
  116.         weCurrentDrag             = 'drag';    { drag currently being tracked from WEClick }
  117.         weDrawTextHook             = 'draw';    { text drawing hook }
  118.         weEraseHook                = 'eras';    { background erasing hook }
  119.         weHiliteDropAreaHook     = 'hidr';    { drop area highlighting hook }
  120.         weLineBreakHook         = 'lbrk';    { line breaking hook }
  121.         wePixelToCharHook         = 'p2c ';    { PixelToChar hook }
  122.         wePort                     = 'port';    { graphics port }
  123.         weRefCon                 = 'refc';    { reference constant for use by application }
  124.         weScrollProc             = 'scrl';    { scroll callback }
  125.         weText                     = 'text';    { handle to the raw text }
  126.         weTranslateDragHook     = 'xdrg';    { drag translation callback }
  127.         weTranslucencyThreshold    = 'tluc';    { area threshold for translucent drags }
  128.         weTSMDocumentID         = 'tsmd';    { Text Services Manager document ID }
  129.         weTSMPreUpdate             = 'pre ';    { Text Services Manager pre-update callback }
  130.         weTSMPostUpdate         = 'post';    { Text Services Manager post-update callback }
  131.         weURLHint                 = 'urlh';    { URL hint string for Internet Config }
  132.         weWordBreakHook         = 'wbrk';    { word breaking hook }
  133.  
  134. { values for WEInstallObjectHandler handlerSelector parameter }
  135.  
  136.         weNewHandler             = 'new ';    { new handler }
  137.         weDisposeHandler         = 'free';    { dispose handler }
  138.         weDrawHandler             = 'draw';    { draw handler }
  139.         weClickHandler             = 'clik';    { click handler }
  140.         weStreamHandler         = 'strm';    { stream handler }
  141.  
  142. { action kinds }
  143.  
  144.         weAKNone             = 0;    { null action }
  145.         weAKUnspecified     = 1;    { action of unspecified nature }
  146.         weAKTyping             = 2;    { some text has been typed in }
  147.         weAKCut             = 3;    { the selection range has been cut }
  148.         weAKPaste             = 4;    { something has been pasted }
  149.         weAKClear             = 5;    { the selection range has been deleted }
  150.         weAKDrag             = 6;    { drag and drop operation }
  151.         weAKSetStyle         = 7;    { some style has been applied to a text range }
  152.  
  153. { destination kinds for stream handler }
  154.  
  155.         weToScrap        =    0;
  156.         weToDrag        =    1;
  157.         weToSoup        =    2;
  158.  
  159.     TYPE
  160.  
  161. { WASTE data types }
  162.  
  163.         WEReference = Ptr;
  164.         WEObjectReference = Ptr;
  165.         WESoupHandle = Handle;
  166.         WEFontTableHandle = Handle;
  167.         WEActionKind = INTEGER;
  168.         WEAlignment = SignedByte;
  169.         WEDirection = INTEGER;
  170.         WEStyleMode = INTEGER;
  171.         WESelector = FourCharCode;
  172.         WEHandle = WEReference;        { obsolete; kept for backward compatibility }
  173.  
  174.         WERunInfo = RECORD
  175.                 runStart: LONGINT;                { byte offset to first character of style run }
  176.                 runEnd: LONGINT;                { byte offset past last character of style run }
  177.                 runHeight: INTEGER;                { line height (ascent + descent + leading) }
  178.                 runAscent: INTEGER;                { font ascent }
  179.                 runStyle: TextStyle;            { text attributes }
  180.                 runObject: WEObjectReference;    { either NIL or reference to embedded object }
  181.             END;  { WERunInfo }
  182.  
  183. { callback prototypes }
  184.  
  185. { FUNCTION MyClickLoop(we: WEReference): BOOLEAN; }
  186.         WEClickLoopProcPtr = ProcPtr;
  187.         WEClickLoopUPP = UniversalProcPtr;
  188.  
  189. { PROCEDURE MyScrollProc(we: WEReference); }
  190.         WEScrollProcPtr = ProcPtr;
  191.         WEScrollUPP = UniversalProcPtr;
  192.  
  193. { PROCEDURE MyTSMPreUpdate(we: WEReference); }
  194.         WETSMPreUpdateProcPtr = ProcPtr;
  195.         WETSMPreUpdateUPP = UniversalProcPtr;
  196.  
  197. { PROCEDURE MyTSMPostUpdate(we: WEReference; fixLength: LONGINT; }
  198. {         inputAreaStart, inputAreaEnd:LONGINT; }
  199. {        pinRangeStart, pinRangeEnd: LONGINT); }
  200.         WETSMPostUpdateProcPtr = ProcPtr;
  201.         WETSMPostUpdateUPP = UniversalProcPtr;
  202.  
  203. { FUNCTION MyTranslateDrag (theDrag: DragReference; theItem: ItemReference; }
  204. {         requestedType: FlavorType; putDataHere: Handle): OSErr; }
  205.         WETranslateDragProcPtr = ProcPtr;
  206.         WETranslateDragUPP = UniversalProcPtr;
  207.  
  208. { FUNCTION MyHiliteDropArea (theDrag: DragReference; hiliteFlag: BOOLEAN; }
  209. {        we: WEReference); }
  210.         WEHiliteDropAreaProcPtr = ProcPtr;
  211.         WEHiliteDropAreaUPP = UniversalProcPtr;
  212.  
  213. { FUNCTION MyFontIDToName (fontID: INTEGER; VAR fontName: Str255): OSErr; }
  214.         WEFontIDToNameProcPtr = ProcPtr;
  215.         WEFontIDToNameUPP = UniversalProcPtr;
  216.  
  217. { FUNCTION MyFontNameToID (fontName: Str255; oldFontID: INTEGER; }
  218. {        VAR newFontID: INTEGER): OSErr; }
  219.         WEFontNameToIDProcPtr = ProcPtr;
  220.         WEFontNameToIDUPP = UniversalProcPtr;
  221.  
  222. { PROCEDURE MyDrawText (pText: Ptr; textLength: LONGINT; slop: Fixed; }
  223. {         styleRunPosition: JustStyleCode; we: WEReference); }
  224.         WEDrawTextProcPtr = ProcPtr;
  225.         WEDrawTextUPP = UniversalProcPtr;
  226.  
  227. { FUNCTION MyPixelToChar (pText: Ptr; textLength: LONGINT; slop: Fixed; }
  228. {         VAR pixelWidth: Fixed; VAR edge: SignedByte; }
  229. {         styleRunPosition: JustStyleCode; hPos: Fixed; we: WEReference): LONGINT; }
  230.         WEPixelToCharProcPtr = ProcPtr;
  231.         WEPixelToCharUPP = UniversalProcPtr;
  232.  
  233. { FUNCTION MyCharToPixel (pText: Ptr; textLength: LONGINT; slop: Fixed; }
  234. {        offset: LONGINT; direction: INTEGER; }
  235. {        styleRunPosition: JustStyleCode; hPos: INTEGER; we:WEReference): INTEGER; }
  236.         WECharToPixelProcPtr = ProcPtr;
  237.         WECharToPixelUPP = UniversalProcPtr;
  238.  
  239. { FUNCTION MyLineBreak (pText: Ptr; textLength: LONGINT; }
  240. {        textStart, textEnd: LONGINT; VAR textWidth: Fixed; VAR textOffset: LONGINT; }
  241. {        we: WEReference): StyledLineBreakCode; }
  242.         WELineBreakProcPtr = ProcPtr;
  243.         WELineBreakUPP = UniversalProcPtr;
  244.  
  245. { PROCEDURE MyWordBreak (pText: Ptr; textLength, offset: INTEGER; edge: SignedByte; }
  246. {                    VAR breakOffsets: OffsetTable; script: ScriptCode; we: WEReference); }
  247.         WEWordBreakProcPtr = ProcPtr;
  248.         WEWordBreakUPP = UniversalProcPtr;
  249.  
  250. { FUNCTION MyCharByte (pText: Ptr; textOffset: INTEGER; }
  251. {                     script: ScriptCode; we: WEReference): INTEGER; }
  252.         WECharByteProcPtr = ProcPtr;
  253.         WECharByteUPP = UniversalProcPtr;
  254.  
  255. { FUNCTION MyCharType (pText: Ptr; textOffset: INTEGER; }
  256. {                     script: ScriptCode; we: WEReference): INTEGER; }
  257.         WECharTypeProcPtr = ProcPtr;
  258.         WECharTypeUPP = UniversalProcPtr;
  259.  
  260. { PROCEDURE MyErase (VAR area: Rect; we: WEReference); }
  261.         WEEraseProcPtr = ProcPtr;
  262.         WEEraseUPP = UniversalProcPtr;
  263.  
  264. { FUNCTION MyNewObject (VAR defaultObjectSize: Point; }
  265. {                    objectRef: WEObjectReference): OSErr; }
  266.         WENewObjectProcPtr = ProcPtr;
  267.         WENewObjectUPP = UniversalProcPtr;
  268.  
  269. { FUNCTION MyDisposeObject (objectRef: WEObjectReference): OSErr; }
  270.         WEDisposeObjectProcPtr = ProcPtr;
  271.         WEDisposeObjectUPP = UniversalProcPtr;
  272.  
  273. { FUNCTION MyDrawObject (VAR destRect: Rect; }
  274. {         objectRef: WEObjectReference): OSErr }
  275.         WEDrawObjectProcPtr = ProcPtr;
  276.         WEDrawObjectUPP = UniversalProcPtr;
  277.  
  278. { FUNCTION MyClickObject (hitPt: Point; modifiers: EventModifiers; clickTime: LONGINT; }
  279. {         objectRef: WEObjectReference): BOOLEAN; }
  280.         WEClickObjectProcPtr = ProcPtr;
  281.         WEClickObjectUPP = UniversalProcPtr;
  282.  
  283. { FUNCTION MyStreamObject (destKind: INTEGER; VAR theType: FlavorType; }
  284. {        putDataHere: Handle; objectRef: WEObjectReference): OSErr; }
  285.         WEStreamObjectProcPtr = ProcPtr;
  286.         WEStreamObjectUPP = UniversalProcPtr;
  287.  
  288.     CONST
  289.  
  290. { UPP proc info }
  291.  
  292.         uppWEClickLoopProcInfo             = $000000D0;
  293.         uppWEScrollProcInfo             = $000000C0;
  294.         uppWETSMPreUpdateProcInfo         = $000000C0;
  295.         uppWETSMPostUpdateProcInfo         = $0003FFC0;
  296.         uppWETranslateDragProcInfo         = $0003FFE0;
  297.         uppWEHiliteDropAreaProcInfo     = $00000DE0;
  298.         uppWEFontIDToNameProcInfo        = $000003A0;
  299.         uppWEFontNameToIDProcInfo        = $00000EE0;
  300.         uppWEDrawTextProcInfo             = $0000EFC0;
  301.         uppWEPixelToCharProcInfo         = $003EFFF0;
  302.         uppWECharToPixelProcInfo         = $003ABFE0;
  303.         uppWELineBreakProcInfo             = $000FFFD0;
  304.         uppWEWordBreakProcInfo             = $000EDAC0;
  305.         uppWECharByteProcInfo             = $00003AE0;
  306.         uppWECharTypeProcInfo             = $00003AE0;
  307.         uppWEEraseProcInfo                = $000003C0;
  308.         uppWENewObjectProcInfo             = $000003E0;
  309.         uppWEDisposeObjectProcInfo         = $000000E0;
  310.         uppWEDrawObjectProcInfo         = $000003E0;
  311.         uppWEClickObjectProcInfo         = $00003ED0;
  312.         uppWEStreamObjectProcInfo         = $00003FA0;
  313.  
  314. { NewProc macros }
  315.  
  316.     FUNCTION NewWEClickLoopProc (userRoutine: WEClickLoopProcPtr): WEClickLoopUPP;
  317. {$IFC NOT GENERATINGCFM}
  318.     INLINE
  319.         $2E9F;
  320. {$ENDC}
  321.  
  322.     FUNCTION NewWEScrollProc (userRoutine: WEScrollProcPtr): WEScrollUPP;
  323. {$IFC NOT GENERATINGCFM}
  324.     INLINE
  325.         $2E9F;
  326. {$ENDC}
  327.  
  328.     FUNCTION NewWETSMPreUpdateProc (userRoutine: WETSMPreUpdateProcPtr): WETSMPreUpdateUPP;
  329. {$IFC NOT GENERATINGCFM}
  330.     INLINE
  331.         $2E9F;
  332. {$ENDC}
  333.  
  334.     FUNCTION NewWETSMPostUpdateProc (userRoutine: WETSMPostUpdateProcPtr): WETSMPostUpdateUPP;
  335. {$IFC NOT GENERATINGCFM}
  336.     INLINE
  337.         $2E9F;
  338. {$ENDC}
  339.  
  340.     FUNCTION NewWETranslateDragProc (userRoutine: WETranslateDragProcPtr): WETranslateDragUPP;
  341. {$IFC NOT GENERATINGCFM}
  342.     INLINE
  343.         $2E9F;
  344. {$ENDC}
  345.  
  346.     FUNCTION NewWEHiliteDropAreaProc (userRoutine: WEHiliteDropAreaProcPtr): WEHiliteDropAreaUPP;
  347. {$IFC NOT GENERATINGCFM}
  348.     INLINE
  349.         $2E9F;
  350. {$ENDC}
  351.  
  352.     FUNCTION NewWEFontIDToNameProc (userRoutine: WEFontIDToNameProcPtr): WEFontIDToNameUPP;
  353. {$IFC NOT GENERATINGCFM}
  354.     INLINE
  355.         $2E9F;
  356. {$ENDC}
  357.  
  358.     FUNCTION NewWEFontNameToIDProc (userRoutine: WEFontNameToIDProcPtr): WEFontNameToIDUPP;
  359. {$IFC NOT GENERATINGCFM}
  360.     INLINE
  361.         $2E9F;
  362. {$ENDC}
  363.  
  364.     FUNCTION NewWEDrawTextProc (userRoutine: WEDrawTextProcPtr): WEDrawTextUPP;
  365. {$IFC NOT GENERATINGCFM}
  366.     INLINE
  367.         $2E9F;
  368. {$ENDC}
  369.  
  370.     FUNCTION NewWEPixelToCharProc (userRoutine: WEPixelToCharProcPtr): WEPixelToCharUPP;
  371. {$IFC NOT GENERATINGCFM}
  372.     INLINE
  373.         $2E9F;
  374. {$ENDC}
  375.  
  376.     FUNCTION NewWECharToPixelProc (userRoutine: WECharToPixelProcPtr): WECharToPixelUPP;
  377. {$IFC NOT GENERATINGCFM}
  378.     INLINE
  379.         $2E9F;
  380. {$ENDC}
  381.  
  382.     FUNCTION NewWELineBreakProc (userRoutine: WELineBreakProcPtr): WELineBreakUPP;
  383. {$IFC NOT GENERATINGCFM}
  384.     INLINE
  385.         $2E9F;
  386. {$ENDC}
  387.  
  388.     FUNCTION NewWEWordBreakProc (userRoutine: WEWordBreakProcPtr): WEWordBreakUPP;
  389. {$IFC NOT GENERATINGCFM}
  390.     INLINE
  391.         $2E9F;
  392. {$ENDC}
  393.  
  394.     FUNCTION NewWECharByteProc (userRoutine: WECharByteProcPtr): WECharByteUPP;
  395. {$IFC NOT GENERATINGCFM}
  396.     INLINE
  397.         $2E9F;
  398. {$ENDC}
  399.  
  400.     FUNCTION NewWECharTypeProc (userRoutine: WECharTypeProcPtr): WECharTypeUPP;
  401. {$IFC NOT GENERATINGCFM}
  402.     INLINE
  403.         $2E9F;
  404. {$ENDC}
  405.  
  406.     FUNCTION NewWEEraseProc (userRoutine: WEEraseProcPtr): WEEraseUPP;
  407. {$IFC NOT GENERATINGCFM}
  408.     INLINE
  409.         $2E9F;
  410. {$ENDC}
  411.  
  412.     FUNCTION NewWENewObjectProc (userRoutine: WENewObjectProcPtr): WENewObjectUPP;
  413. {$IFC NOT GENERATINGCFM}
  414.     INLINE
  415.         $2E9F;
  416. {$ENDC}
  417.  
  418.     FUNCTION NewWEDisposeObjectProc (userRoutine: WEDisposeObjectProcPtr): WEDisposeObjectUPP;
  419. {$IFC NOT GENERATINGCFM}
  420.     INLINE
  421.         $2E9F;
  422. {$ENDC}
  423.  
  424.     FUNCTION NewWEDrawObjectProc (userRoutine: WEDrawObjectProcPtr): WEDrawObjectUPP;
  425. {$IFC NOT GENERATINGCFM}
  426.     INLINE
  427.         $2E9F;
  428. {$ENDC}
  429.  
  430.     FUNCTION NewWEClickObjectProc (userRoutine: WEClickObjectProcPtr): WEClickObjectUPP;
  431. {$IFC NOT GENERATINGCFM}
  432.     INLINE
  433.         $2E9F;
  434. {$ENDC}
  435.  
  436.     FUNCTION NewWEStreamObjectProc (userRoutine: WEStreamObjectProcPtr): WEStreamObjectUPP;
  437. {$IFC NOT GENERATINGCFM}
  438.     INLINE
  439.         $2E9F;
  440. {$ENDC}
  441.  
  442. { CallProc macros }
  443.  
  444.     FUNCTION CallWEClickLoopProc (we: WEReference;
  445.                                     userRoutine: WEClickLoopUPP): BOOLEAN;
  446. {$IFC NOT GENERATINGCFM}
  447.     INLINE
  448.         $205F, $4E90;
  449. {$ENDC}
  450.  
  451.     PROCEDURE CallWEScrollProc (we: WEReference;
  452.                                     userRoutine: WEScrollUPP);
  453. {$IFC NOT GENERATINGCFM}
  454.     INLINE
  455.         $205F, $4E90;
  456. {$ENDC}
  457.  
  458.     PROCEDURE CallWETSMPreUpdateProc (we: WEReference;
  459.                                     userRoutine: WETSMPreUpdateUPP);
  460. {$IFC NOT GENERATINGCFM}
  461.     INLINE
  462.         $205F, $4E90;
  463. {$ENDC}
  464.  
  465.     PROCEDURE CallWETSMPostUpdateProc (we: WEReference;
  466.                                     fixLength: LONGINT;
  467.                                     inputAreaStart, inputAreaEnd: LONGINT;
  468.                                     pinRangeStart, pinRangeEnd: LONGINT;
  469.                                     userRoutine: WETSMPostUpdateUPP);
  470. {$IFC NOT GENERATINGCFM}
  471.     INLINE
  472.         $205F, $4E90;
  473. {$ENDC}
  474.  
  475.     FUNCTION CallWETranslateDragProc (theDrag: DragReference;
  476.                                     theItem: ItemReference;
  477.                                     requestedType: FlavorType;
  478.                                     putDataHere: Handle;
  479.                                     userRoutine: WETranslateDragUPP): OSErr;
  480. {$IFC NOT GENERATINGCFM}
  481.     INLINE
  482.         $205F, $4E90;
  483. {$ENDC}
  484.  
  485.     FUNCTION CallWEHiliteDropAreaProc (theDrag: DragReference;
  486.                                     hiliteFlag: BOOLEAN;
  487.                                     we: WEReference;
  488.                                     userRoutine: WEHiliteDropAreaUPP): OSErr;
  489. {$IFC NOT GENERATINGCFM}
  490.     INLINE
  491.         $205F, $4E90;
  492. {$ENDC}
  493.  
  494.     FUNCTION CallWEFontIDToNameProc (fontID: INTEGER;
  495.                                     VAR fontName: Str255;
  496.                                     userRoutine: WEFontIDToNameUPP): OSErr;
  497. {$IFC NOT GENERATINGCFM}
  498.     INLINE
  499.         $205F, $4E90;
  500. {$ENDC}
  501.  
  502.     FUNCTION CallWEFontNameToIDProc ({CONST} VAR fontName: Str255;
  503.                                     oldFontID: INTEGER;
  504.                                     VAR newFontID: INTEGER;
  505.                                     userRoutine: WEFontNameToIDUPP): OSErr;
  506. {$IFC NOT GENERATINGCFM}
  507.     INLINE
  508.         $205F, $4E90;
  509. {$ENDC}
  510.  
  511.     PROCEDURE CallWEDrawTextProc (pText: Ptr;
  512.                                     textLength: LONGINT;
  513.                                     slop: Fixed;
  514.                                     styleRunPosition: JustStyleCode;
  515.                                     we: WEReference;
  516.                                     userRoutine: WEDrawTextUPP);
  517. {$IFC NOT GENERATINGCFM}
  518.     INLINE
  519.         $205F, $4E90;
  520. {$ENDC}
  521.  
  522.     FUNCTION CallWEPixelToCharProc (pText: Ptr;
  523.                                     textLength: LONGINT;
  524.                                     slop: Fixed;
  525.                                     VAR width: Fixed;
  526.                                     VAR edge: SignedByte;
  527.                                     styleRunPosition: JustStyleCode;
  528.                                     hPos: Fixed;
  529.                                     we: WEReference;
  530.                                     userRoutine: WEPixelToCharUPP): LONGINT;
  531. {$IFC NOT GENERATINGCFM}
  532.     INLINE
  533.         $205F, $4E90;
  534. {$ENDC}
  535.  
  536.     FUNCTION CallWECharToPixelProc (pText: Ptr;
  537.                                     textLength: LONGINT;
  538.                                     slop: Fixed;
  539.                                     offset: LONGINT;
  540.                                     direction: INTEGER;
  541.                                     styleRunPosition: JustStyleCode;
  542.                                     hPos: INTEGER;
  543.                                     we: WEReference;
  544.                                     userRoutine: WECharToPixelUPP): INTEGER;
  545. {$IFC NOT GENERATINGCFM}
  546.     INLINE
  547.         $205F, $4E90;
  548. {$ENDC}
  549.  
  550.     FUNCTION CallWELineBreakProc (pText: Ptr;
  551.                                     textLength: LONGINT;
  552.                                     textStart, textEnd: LONGINT;
  553.                                     VAR textWidth: Fixed;
  554.                                     VAR textOffset: LONGINT;
  555.                                     we: WEReference;
  556.                                     userRoutine: WELineBreakUPP): StyledLineBreakCode;
  557. {$IFC NOT GENERATINGCFM}
  558.     INLINE
  559.         $205F, $4E90;
  560. {$ENDC}
  561.  
  562.     PROCEDURE CallWEWordBreakProc (pText: Ptr;
  563.                                     textLength, offset: INTEGER;
  564.                                     edge: SignedByte;
  565.                                     VAR breakOffsets: OffsetTable;
  566.                                     script: ScriptCode;
  567.                                     we: WEReference;
  568.                                     userRoutine: WEWordBreakUPP);
  569. {$IFC NOT GENERATINGCFM}
  570.     INLINE
  571.         $205F, $4E90;
  572. {$ENDC}
  573.  
  574.     FUNCTION CallWECharByteProc (pText: Ptr;
  575.                                     textOffset: INTEGER;
  576.                                     script: ScriptCode;
  577.                                     we: WEReference;
  578.                                     userRoutine: WECharByteUPP): INTEGER;
  579. {$IFC NOT GENERATINGCFM}
  580.     INLINE
  581.         $205F, $4E90;
  582. {$ENDC}
  583.  
  584.     FUNCTION CallWECharTypeProc (pText: Ptr;
  585.                                     textOffset: INTEGER;
  586.                                     script: ScriptCode;
  587.                                     we: WEReference;
  588.                                     userRoutine: WECharTypeUPP): INTEGER;
  589. {$IFC NOT GENERATINGCFM}
  590.     INLINE
  591.         $205F, $4E90;
  592. {$ENDC}
  593.  
  594.     PROCEDURE CallWEEraseProc ({CONST} VAR area: Rect;
  595.                                     we: WEReference;
  596.                                     userRoutine: WEEraseUPP);
  597. {$IFC NOT GENERATINGCFM}
  598.     INLINE
  599.         $205F, $4E90;
  600. {$ENDC}
  601.  
  602.     FUNCTION CallWENewObjectProc (VAR defaultObjectSize: Point;
  603.                                     objectRef: WEObjectReference;
  604.                                     userRoutine: WENewObjectUPP): OSErr;
  605. {$IFC NOT GENERATINGCFM}
  606.     INLINE
  607.         $205F, $4E90;
  608. {$ENDC}
  609.  
  610.     FUNCTION CallWEDisposeObjectProc (objectRef: WEObjectReference;
  611.                                     userRoutine: WEDisposeObjectUPP): OSErr;
  612. {$IFC NOT GENERATINGCFM}
  613.     INLINE
  614.         $205F, $4E90;
  615. {$ENDC}
  616.  
  617.     FUNCTION CallWEDrawObjectProc ({CONST} VAR destRect: Rect;
  618.                                     objectRef: WEObjectReference;
  619.                                     userRoutine: WEDrawObjectUPP): OSErr;
  620. {$IFC NOT GENERATINGCFM}
  621.     INLINE
  622.         $205F, $4E90;
  623. {$ENDC}
  624.  
  625.     FUNCTION CallWEClickObjectProc (hitPoint: Point;
  626.                                     modifiers: EventModifiers;
  627.                                     clickTime: LONGINT;
  628.                                     objectRef: WEObjectReference;
  629.                                     userRoutine: WEClickObjectUPP): BOOLEAN;
  630. {$IFC NOT GENERATINGCFM}
  631.     INLINE
  632.         $205F, $4E90;
  633. {$ENDC}
  634.  
  635.     FUNCTION CallWEStreamObjectProc (destKind: INTEGER;
  636.                                     VAR theType: FlavorType;
  637.                                     putDataHere: Handle;
  638.                                     objectRef: WEObjectReference;
  639.                                     userRoutine: WEStreamObjectUPP): OSErr;
  640. {$IFC NOT GENERATINGCFM}
  641.     INLINE
  642.         $205F, $4E90;
  643. {$ENDC}
  644.  
  645.  
  646. { WASTE PUBLIC CALLS }
  647.  
  648. { getting the shared library version number }
  649.  
  650.     FUNCTION WEVersion: NumVersion;
  651.  
  652. { creation and destruction }
  653.  
  654.     FUNCTION WENew ({CONST} VAR destRect, viewRect: LongRect;
  655.                                     flags: LONGINT;
  656.                                     VAR we: WEReference): OSErr;
  657.     PROCEDURE WEDispose (we: WEReference);
  658.  
  659. { getting variables }
  660.  
  661.     FUNCTION WEGetText (we: WEReference): Handle;
  662.     FUNCTION WEGetChar (offset: LONGINT;
  663.                                     we: WEReference): CHAR;
  664.     FUNCTION WEGetTextLength (we: WEReference): LONGINT;
  665.     FUNCTION WEGetHeight (startLine, endLine: LONGINT;
  666.                                     we: WEReference): LONGINT;
  667.     PROCEDURE WEGetSelection (VAR selStart, selEnd: LONGINT;
  668.                                     we: WEReference);
  669.     PROCEDURE WEGetDestRect (VAR destRect: LongRect;
  670.                                     we: WEReference);
  671.     PROCEDURE WEGetViewRect (VAR viewRect: LongRect;
  672.                                     we: WEReference);
  673.     FUNCTION WEIsActive (we: WEReference): BOOLEAN;
  674.     FUNCTION WEOffsetToLine (offset: LONGINT;
  675.                                     we: WEReference): LONGINT;
  676.     PROCEDURE WEGetLineRange (lineNo: LONGINT;
  677.                                     VAR lineStart, lineEnd: LONGINT;
  678.                                     we: WEReference);
  679.     FUNCTION WECountLines (we: WEReference): LONGINT;
  680.     FUNCTION WEOffsetToRun (offset: LONGINT;
  681.                                     we: WEReference): LONGINT;
  682.     PROCEDURE WEGetRunRange (runIndex: LONGINT;
  683.                                     VAR runStart, runEnd: LONGINT;
  684.                                     we: WEReference);
  685.     FUNCTION WECountRuns (we: WEReference): LONGINT;
  686.     FUNCTION WEGetClickCount (we: WEReference): INTEGER;
  687.  
  688. { setting variables }
  689.  
  690.     PROCEDURE WESetSelection (selStart, selEnd: LONGINT;
  691.                                     we: WEReference);
  692.     PROCEDURE WESetDestRect ({CONST} VAR destRect: LongRect;
  693.                                     we: WEReference);
  694.     PROCEDURE WESetViewRect ({CONST} VAR viewRect: LongRect;
  695.                                     we: WEReference);
  696.  
  697. { accessing style run information }
  698.  
  699.     FUNCTION WEContinuousStyle (VAR mode: WEStyleMode;
  700.                                     VAR ts: TextStyle;
  701.                                     we: WEReference): BOOLEAN;
  702.     PROCEDURE WEGetRunInfo (offset: LONGINT;
  703.                                     VAR info: WERunInfo;
  704.                                     we: WEReference);
  705.  
  706. { converting byte offsets to screen positions and vice versa }
  707.  
  708.     FUNCTION WEGetOffset ({CONST} VAR thePoint: LongPt;
  709.                                     VAR edge: SignedByte;
  710.                                     we: WEReference): LONGINT;
  711.     PROCEDURE WEGetPoint (offset: LONGINT;
  712.                                     direction: INTEGER;
  713.                                     VAR thePoint: LongPt;
  714.                                     VAR lineHeight: INTEGER;
  715.                                     we: WEReference);
  716.  
  717. { finding words and lines }
  718.  
  719.     PROCEDURE WEFindWord (offset: LONGINT;
  720.                                     edge: SignedByte;
  721.                                     VAR wordStart, wordEnd: LONGINT;
  722.                                     we: WEReference);
  723.     PROCEDURE WEFindLine (offset: LONGINT;
  724.                                     edge: SignedByte;
  725.                                     VAR lineStart, lineEnd: LONGINT;
  726.                                     we: WEReference);
  727.  
  728. { making a copy of a text range }
  729.  
  730.     FUNCTION WECopyRange (rangeStart, rangeEnd: LONGINT;
  731.                                     hText: Handle;
  732.                                     hStyles: StScrpHandle;
  733.                                     hSoup: WESoupHandle;
  734.                                     we: WEReference): OSErr;
  735.  
  736. { getting and setting the alignment style }
  737.  
  738.     FUNCTION WEGetAlignment (we: WEReference): WEAlignment;
  739.     PROCEDURE WESetAlignment (alignment: WEAlignment;
  740.                                     we: WEReference);
  741.  
  742. { getting and setting the primary line direction }
  743.  
  744.     FUNCTION WEGetDirection (we: WEReference): WEDirection;
  745.     PROCEDURE WESetDirection (direction: WEDirection;
  746.                                     we: WEReference);
  747.  
  748. { recalculating line breaks, drawing and scrolling }
  749.  
  750.     FUNCTION WECalText (we: WEReference): OSErr;
  751.     PROCEDURE WEUpdate (updateRgn: RgnHandle;
  752.                                     we: WEReference);
  753.     PROCEDURE WEScroll (hOffset, vOffset: LONGINT;
  754.                                     we: WEReference);
  755.     PROCEDURE WESelView (we: WEReference);
  756.  
  757. { handling activate/deactivate events }
  758.  
  759.     PROCEDURE WEActivate (we: WEReference);
  760.     PROCEDURE WEDeactivate (we: WEReference);
  761.  
  762. { handling key-down events }
  763.  
  764.     PROCEDURE WEKey (key: CHAR;
  765.                                     modifiers: EventModifiers;
  766.                                     we: WEReference);
  767.  
  768. { handling mouse-down events and mouse tracking }
  769.  
  770.     PROCEDURE WEClick (hitPt: Point;
  771.                                     modifiers: EventModifiers;
  772.                                     clickTime: LONGINT;
  773.                                     we: WEReference);
  774.  
  775. { adjusting the cursor shape }
  776.  
  777.     FUNCTION WEAdjustCursor (mouseLoc: Point;
  778.                                     mouseRgn: RgnHandle;
  779.                                     we: WEReference): BOOLEAN;
  780.  
  781. { blinking the caret }
  782.  
  783.     PROCEDURE WEIdle (VAR maxSleep: LONGINT;
  784.                                     we: WEReference);
  785.  
  786. { modifying the text and the styles }
  787.  
  788.     FUNCTION WEInsert (pText: Ptr;
  789.                                     textLength: LONGINT;
  790.                                     hStyles: StScrpHandle;
  791.                                     hSoup: WESoupHandle;
  792.                                     we: WEReference): OSErr;
  793.     FUNCTION WEDelete (we: WEReference): OSErr;
  794.     FUNCTION WESetStyle (mode: WEStyleMode;
  795.                                     {CONST} VAR ts: TextStyle;
  796.                                     we: WEReference): OSErr;
  797.     FUNCTION WEUseText (hText: Handle;
  798.                                     we: WEReference): OSErr;
  799.     FUNCTION WEUseStyleScrap (hStyles: StScrpHandle;
  800.                                     we: WEReference): OSErr;
  801.  
  802. { undo }
  803.  
  804.     FUNCTION WEUndo (we: WEReference): OSErr;
  805.     PROCEDURE WEClearUndo (we: WEReference);
  806.     FUNCTION WEGetUndoInfo (VAR redoFlag: BOOLEAN;
  807.                                     we: WEReference): WEActionKind;
  808.     FUNCTION WEIsTyping (we: WEReference): BOOLEAN;
  809.     FUNCTION WEBeginAction (we: WEReference): OSErr;
  810.     FUNCTION WEEndAction (actionKind: WEActionKind;
  811.                                     we: WEReference): OSErr;
  812.  
  813. { keeping track of changes }
  814.  
  815.     FUNCTION WEGetModCount (we: WEReference): LONGINT;
  816.     PROCEDURE WEResetModCount (we: WEReference);
  817.  
  818. { embedded objects }
  819.  
  820.     FUNCTION WEInstallObjectHandler (objectType: FlavorType;
  821.                                     handlerSelector: WESelector;
  822.                                     handler: ProcPtr;
  823.                                     we: WEReference): OSErr;
  824.     FUNCTION WEGetObjectHandler (objectType: FlavorType;
  825.                                     handlerSelector: WESelector;
  826.                                     VAR handler: ProcPtr;
  827.                                     we: WEReference): OSErr;
  828.     FUNCTION WEInsertObject (objectType: FlavorType;
  829.                                     objectDataHandle: Handle;
  830.                                     objectSize: Point;        { (0, 0) means default size }
  831.                                     we: WEReference): OSErr;
  832.     FUNCTION WEGetSelectedObject (VAR objectRef: WEObjectReference;
  833.                                     we: WEReference): OSErr;
  834.     FUNCTION WEFindNextObject (offset: LONGINT;
  835.                                     VAR objectRef: WEObjectReference;
  836.                                     we: WEReference): LONGINT;
  837.     FUNCTION WEUseSoup (hSoup: WESoupHandle;
  838.                                     we: WEReference): LONGINT;
  839.  
  840. { accessing embedded object attributes }
  841.  
  842.     FUNCTION WEGetObjectType (objectRef: WEObjectReference): FlavorType;
  843.     FUNCTION WEGetObjectDataHandle (objectRef: WEObjectReference): Handle;
  844.     FUNCTION WEGetObjectSize (objectRef: WEObjectReference): Point;
  845.     FUNCTION WEGetObjectOwner (objectRef: WEObjectReference): WEReference;
  846.     FUNCTION WEGetObjectRefCon (objectRef: WEObjectReference): LONGINT;
  847.     PROCEDURE WESetObjectRefCon (objectRef: WEObjectReference;
  848.                                     refCon: LONGINT);
  849.  
  850. { Clipboard operations }
  851.  
  852.     FUNCTION WECut (we: WEReference): OSErr;
  853.     FUNCTION WECopy (we: WEReference): OSErr;
  854.     FUNCTION WEPaste (we: WEReference): OSErr;
  855.     FUNCTION WECanPaste (we: WEReference): BOOLEAN;
  856.  
  857. { Drag Manager support }
  858.  
  859.     FUNCTION WEGetHiliteRgn (rangeStart, rangeEnd: LONGINT;
  860.                                     we: WEReference): RgnHandle;
  861.     FUNCTION WETrackDrag (message: DragTrackingMessage;
  862.                                     drag: DragReference;
  863.                                     we: WEReference): OSErr;
  864.     FUNCTION WEReceiveDrag (drag: DragReference;
  865.                                     we: WEReference): OSErr;
  866.     FUNCTION WECanAcceptDrag (drag: DragReference;
  867.                                     we: WEReference): BOOLEAN;
  868.     FUNCTION WEDraggedToTrash (drag: DragReference): BOOLEAN;
  869.  
  870. { font tables }
  871.  
  872.     FUNCTION WEBuildFontTable (hFontTable: WEFontTableHandle;
  873.                                     fontIDToNameProc: WEFontIDToNameUPP;
  874.                                     we: WEReference): OSErr;
  875.     FUNCTION WEUpdateFontTable (hFontTable: WEFontTableHandle;
  876.                                     fontNameToIDProc: WEFontNameToIDUPP;
  877.                                     VAR wasChanged: BOOLEAN): OSErr;
  878.     FUNCTION WEUpdateStyleScrap (hStyles: StScrpHandle;
  879.                                     hFontTable: WEFontTableHandle): OSErr;
  880.  
  881. { Script Manager utilities }
  882.  
  883.     FUNCTION WECharByte (offset: LONGINT;
  884.                                     we: WEReference): INTEGER;
  885.     FUNCTION WECharType (offset: LONGINT;
  886.                                     we: WEReference): INTEGER;
  887.  
  888. { Text Services Manager support }
  889.  
  890.     FUNCTION WEInstallTSMHandlers: OSErr;
  891.     FUNCTION WERemoveTSMHandlers: OSErr;
  892.     PROCEDURE WEStopInlineSession (we: WEReference);
  893.  
  894. { additional features }
  895.  
  896.     FUNCTION WEFeatureFlag (feature: INTEGER;
  897.                                     action: INTEGER;
  898.                                     we: WEReference): INTEGER;
  899.     FUNCTION WEGetInfo (selector: WESelector;
  900.                                     info: univ Ptr;
  901.                                     we: WEReference): OSErr;
  902.     FUNCTION WESetInfo (selector: WESelector;
  903.                                     info: univ Ptr;
  904.                                     we: WEReference): OSErr;
  905.  
  906. { getting and setting user-defined info }
  907.  
  908.     FUNCTION WEGetUserInfo (tag: WESelector;
  909.                                     VAR userInfo: LONGINT;
  910.                                     we: WEReference): OSErr;
  911.     FUNCTION WESetUserInfo (tag: WESelector;
  912.                                     userInfo: LONGINT;
  913.                                     we: WEReference): OSErr;
  914.  
  915. { long coordinates utility routines }
  916.  
  917.     PROCEDURE WELongPointToPoint ({CONST} VAR lp: LongPt;
  918.                                     VAR p: Point);
  919.     PROCEDURE WEPointToLongPoint (p: Point;
  920.                                     VAR lp: LongPt);
  921.     PROCEDURE WESetLongRect (VAR lr: LongRect;
  922.                                     left, top, right, bottom: LONGINT);
  923.     PROCEDURE WELongRectToRect ({CONST} VAR lr: LongRect;
  924.                                     VAR r: Rect);
  925.     PROCEDURE WERectToLongRect ({CONST} VAR r: Rect;
  926.                                     VAR lr: LongRect);
  927.     PROCEDURE WEOffsetLongRect (VAR lr: LongRect;
  928.                                     hOffset, vOffset: LONGINT);
  929.     FUNCTION WELongPointInLongRect ({CONST} VAR lp: LongPt;
  930.                                     {CONST} VAR lr: LongRect): BOOLEAN;
  931.  
  932. {$ALIGN RESET}
  933. {$POP}
  934.  
  935. IMPLEMENTATION
  936. END.